package com.zxjbyte.yiyi.module.upms.context.properties;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 验证码配置类
 *
 * @Author zhangxingjia
 * @Date 2024/8/14 10:04
 * @Version: 1.0
 */
@Getter
@Setter
@Component
@ConfigurationProperties(prefix = CaptchaProperties.CAPTCHA_PROP_PREFIX)
public class CaptchaProperties {

    public static final String CAPTCHA_PROP_PREFIX = "yiyi.captcha";

    // 图片宽度
    private int width;

    // 图片高度
    private int height;

    // 验证码模式
    private CaptchaMode mode = CaptchaMode.RANDOM_CHAR_NUMBER;

    // 验证码长度（只针对随机数模式有效）
    private int count = 4;

    // 干扰线条数
    private int lineCount = 150;

    public enum CaptchaMode {
        // 计算
        MATH,

        // 字母
        RANDOM_CHAR,

        // 字母+数字
        RANDOM_CHAR_NUMBER,

        // 数字
        RANDOM_NUMBER
    }
}
